home *** CD-ROM | disk | FTP | other *** search
- Sub Train()
-
- 'Define the exclusive-or input data
- Dim InputData(0 To 1, 0 To 3) As Variant
- InputData(0, 0) = 0!
- InputData(0, 1) = 0!
- InputData(0, 2) = 1!
- InputData(0, 3) = 1!
- InputData(1, 0) = 0!
- InputData(1, 1) = 1!
- InputData(1, 2) = 0!
- InputData(1, 3) = 1!
-
- 'Define the exclusive-or desired data
- Dim DesiredData(0 To 0, 0 To 3) As Variant
- DesiredData(0, 0) = 0!
- DesiredData(0, 1) = 1!
- DesiredData(0, 2) = 1!
- DesiredData(0, 3) = 0!
-
- 'Create a learning network object
- Dim nn As New NSLearningNetwork
-
- 'Set the path to the generated neural network DLL
- nn.dllPathName = g_CSWPath + "\Demo\DemoMLP.dll"
-
- 'Send the input data to the neural network DLL
- nn.InputData = InputData
-
- 'Send the desired data to the neural network DLL
- nn.DesiredData = DesiredData
-
- 'Train the neural network for the specified number of epochs
- nn.Train EpochsTextBox.Text
-
- 'Display the best training cost
- BestCostTextBox.Text = Format(nn.bestCost, "0.000000")
- BestCostTextBox.Refresh
-
- End Sub